package action;

import modele.Client;

import com.opensymphony.xwork2.ActionSupport;

import data.ClientXML;

public class AjoutClient extends ActionSupport {
	
	private static final long serialVersionUID = 3950635267464727091L;
	private int id;
	private String nom;
	private String prenom;
	private String adresse;
	private String email;
	
    public String execute() throws Exception {
    	return SUCCESS;
	}
/**
 * permet d'ajouter un client dans le fichier XML
 * @return success
 */
    public String ajouter() {
    	
    	ClientXML clientXML = new ClientXML();
    	id = clientXML.getLastId() + 1;
    	Client client = new Client(id,nom,prenom,adresse,email);
    	clientXML.ajouterClient(client);
    	return SUCCESS;
    }

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getAdresse() {
		return adresse;
	}

	public void setAdresse(String adresse) {
		this.adresse = adresse;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
    
    
}
